package com.dyrj.ysk.exception;

import lombok.Data;

/**
 * @author 吴侠志  2019/9/23
 * @version 1.0
 */
@Data
public class BizException extends Exception{

    private String code;
    private String desc;

    public BizException(ErrorCode errorCode) {
        super(errorCode.code+":"+errorCode.desc);
        this.code=errorCode.code;
        this.desc=errorCode.desc;
    }
    public BizException(ErrorCode errorCode,String detail) {
        super(errorCode.code+":"+errorCode.desc+":"+detail);
        this.code=errorCode.code;
        this.desc=errorCode.desc+":"+detail;
    }
    public enum ErrorCode{
        SIGN_ERROR("0001","友好提示:加签失败"),
        VIRIFY_ERROR("0002","友好提示:验签失败"),
        SYSTEM_ERROR("9999","友好提示:系统异常");

        private String code;
        private String desc;

        ErrorCode(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
}
